package com.qire.manhua.model.vo;

import com.qire.common.model.enumeration.VIPType;
import com.qire.common.support.base.BaseVO;
import com.qire.manhua.model.entity.ComicComment;

public class CommentVO extends BaseVO {
    public int      id;                     //评论ID": 87,
    public int      userid;                 //用户ID": 19971,
    public String   content;                //评论内容": "很好看呀！继续努力！",
    public String   create_time;            //评论时间": "07-05 21:23",
    public int      replie_count;           //回复该评论数量": 4,
    public int      like_count;             //点赞数: 54,
    public int      star_num;               //星星数: 5,
    public UserInfo user_avatar;            //评论用户的基本简洁信息,
    public int      like;                   //我是否点赞: 0

    public class UserInfo{
        public int      id;                 //用户ID: 19971,
        public String   user_name;          //用户昵称: "清风未央",
        public String   user_img;           //用户头像: "http://wx.qlogo.cn/mmopen/8UnxaG7PsibkIJoVm0sQRcnPrYxbleUpmXicibfIHdh4UYnhxAicKn7qib3pzJxtV8c3jH5NNPL98cBMKicicSuzuJicLbSfaQeCCveo/0",
        public int      vipType;            //vip类型
    }

    public ComicComment toComicComment() {

        int userId          = userid;
        String userName     = user_avatar.user_name;
        String userPortrait = user_avatar.user_img;
        String createTime   = create_time;
        int replyCount      = replie_count;
        int likeCount       = like_count;
        int starNumber      = star_num;
        boolean isMyLike    = like == 1;
        VIPType vipType     = VIPType.build(user_avatar.vipType);

        return new ComicComment(id, userId, userName, userPortrait, content, createTime, replyCount, likeCount, isMyLike, vipType);
    }
}